home *** CD-ROM | disk | FTP | other *** search
/ CD ROM Paradise Collection 4 / CD ROM Paradise Collection 4 1995 Nov.iso / program / swagg_m.zip / GRAPHICS.SWG / 0009_ASM Fading.pas < prev    next >
Pascal/Delphi Source File  |  1993-08-27  |  1KB  |  78 lines

  1. {
  2. STEPHEN CHEOK
  3.  
  4. > Could you post the fade out source?
  5. }
  6.  
  7. PROCEDURE DimDisplay(delayfactor : INTEGER); ASSEMBLER;
  8.  
  9. { Total time to fade out in seconds = ((DelayFactor+1)*MaxIntensity) / 1000 }
  10.  
  11. CONST
  12.   MaxIntensity = 45;
  13.  {MaxIntensity = 63;}
  14.  
  15. VAR
  16.   DACTable : Array [0..255] OF RECORD
  17.                R, G, B : BYTE;
  18.              END;
  19. ASM
  20.   PUSH   DS
  21.   MOV    AX, SS
  22.   MOV    ES, AX
  23.   MOV    DS, AX
  24.  
  25.  { Store colour information into DACTable }
  26.  
  27.   LEA    DX, DACTable
  28.   MOV    CX, 256
  29.   XOR    BX, BX
  30.   MOV    AX, 1017h
  31.   INT    10h
  32.  
  33.   MOV    BX, MaxIntensity
  34.  
  35.  { VGA port 3C8h: PEL address register, (colour index,
  36.  increments automatically after every third write)
  37.  VGA port 3C9h: PEL write register (R, G, B) }
  38.  
  39.   CLD
  40.  @1:
  41.   LEA    SI, DACTable
  42.   MOV    DI, SI
  43.   MOV    CX, 3*256
  44.   XOR    AX, AX
  45.   MOV    DX, 3C8h
  46.   OUT    DX, AL
  47.   INC    DX
  48.  
  49.  { Get colour value, decrement it and update the table }
  50.  
  51.  @2:
  52.   LODSB
  53.   OR     AX, AX
  54.   JZ     @3
  55.   DEC    AX
  56.  @3:
  57.   STOSB
  58.   OUT    DX, AL
  59.   LOOP   @2
  60.  
  61.  { Delay before next decrement of R, G, B values }
  62.  
  63.   PUSH   ES
  64.   PUSH   BX
  65.   MOV    AX, DelayFactor
  66.   PUSH   AX
  67.   CALL   Delay
  68.   POP    BX
  69.   POP    ES
  70.  
  71.   DEC    BX
  72.   OR     BX, BX
  73.   JNZ    @1
  74.   POP    DS
  75. END;  { DimDisplay }
  76.  
  77.  
  78.